package legumes.client.services.callbacks;

import legumes.client.services.LegumesServicesHelper;
import legumes.client.services.util.rpc.SequencableRPCCall;
import legumes.shared.domain.NewProductMarket;
import legumes.shared.domain.Product;

public class AddNewProductMarketCallback extends SequencableRPCCall<Product> {

	private NewProductMarket newProductMarket;
	private Product createdProduct;
	
	public AddNewProductMarketCallback(NewProductMarket newProductMarket_) {
		newProductMarket = newProductMarket_;
	}

	@Override
	protected void doCall() {
		LegumesServicesHelper.LEGUMES_SERVICES.addNewProductMarket(newProductMarket, this);
	}

	@Override
	public void onSuccess(Product result_) {
		createdProduct = result_;
		callNext();
	}

	public Product getCreatedProduct() {
		return createdProduct;
	}

}
